package com.liohi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liohi.entity.SimulationEquipment;
import com.liohi.service.SimulationEquipmentService;
import com.liohi.mapper.SimulationEquipmentMapper;
import org.springframework.stereotype.Service;


/**
* @author liohi
* @description 针对表【simulation_equipment】的数据库操作Service实现
 * * @createDate 2023-08-02 15:10:31
*/
@Service
public class SimulationEquipmentServiceImpl extends ServiceImpl<SimulationEquipmentMapper, SimulationEquipment>
    implements SimulationEquipmentService{
    @Override
    public IPage<SimulationEquipment> listByPage(Integer pageNum, Integer pageSize, String num, String name) {
        QueryWrapper<SimulationEquipment> queryWrapper = new QueryWrapper<>();
        if(num != null && !num.isEmpty())
            queryWrapper.like("number",num);
        if(name != null && !name.isEmpty())
            queryWrapper.like("name",name);
        Page<SimulationEquipment> page = new Page<>(pageNum, pageSize);
        return this.baseMapper.selectPage(page, queryWrapper);
    }
}